﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ViewMaker.Core.Utils;
using ViewMaker.Core;

namespace ViewMaker
{
    public static class ViewUtil
    {
        public static void Show(object vm, bool editable = true)
        {
            if (vm == null) throw new ArgumentNullException("vm");
            BuildView(vm, editable).Show();
        }

        public static void ShowDialog(object vm, bool editable = true)
        {
            if (vm == null) throw new ArgumentNullException("vm");
            BuildView(vm, editable).ShowDialog();
        }

        public static object BuildContent(object vm, bool editable = true)
        {
            if (vm == null) throw new ArgumentNullException("vm");
            return ServiceLocator.GetService<IViewGenerateService>().BuildContent(vm, null, editable).Content;
        }

        public static IView BuildView(object vm, bool editable = true)
        {
            if (vm == null) throw new ArgumentNullException("vm");
            return ServiceLocator.GetService<IViewGenerateService>().BuildWindowView(vm, null, editable);
        }
    }
}
